<!DOCTYPE html>
<html>
<head>
    <meta name="layout" content="main"/>
    <g:set var="entityName" value="${message(code: 'account.label', default: 'Account')}"/>
    <title>机构详情编辑</title>
</head>

<body>
<div class="small-header">
    <div class="hpanel">
        <div class="panel-body">
            <div id="hbreadcrumb" class="pull-right navFloatRight">
                <ol class="hbreadcrumb breadcrumb">
                    <li>CINDATA PLS</li>
                    <li class="active">
                        <span>机构详情编辑</span>
                    </li>
                </ol>
            </div>
            <h2 class="font-light m-b-xs">
                机构详情编辑
            </h2>
        </div>
    </div>
</div>

<g:form action="externalAccountUpdate" resource="${this.account}">
    <div class="content animate-panel">
        <div class="row">
            <div class="hpanel hblue">
                <div class="panel-heading">
                    机构详细信息
                </div>

                <div class="panel-body form-horizontal">
                    <g:if test="${flash.message}">
                        <div class="message alert alert-info" role="status">${flash.message}</div>
                    </g:if>
                    <g:hasErrors bean="${this.account}">
                        <ul class="errors" role="alert">
                            <g:eachError bean="${this.account}" var="error">
                                <li <g:if test="${error in org.springframework.validation.FieldError}">data-field-id="${error.field}"</g:if>><g:message error="${error}"/></li>
                            </g:eachError>
                        </ul>
                    </g:hasErrors>

                    <g:hiddenField name="code" value="${params.code}"/>
                    <g:hiddenField name="targetUri" value="${params.targetUri}"/>
                    <div class="form-group">
                        <label class="col-md-2 control-label">企业名称</label>
                        <div class="col-md-3">
                            <label class="control-label">${this.account?.name}</label>
                        </div>
                        <!-- <label class="col-md-2 control-label">机构状态</label>
                        <div class="col-md-3">
                            <g:select class="form-control m-b" name="status" id="status" from="${[[name:'启用',value:1],[name:'禁用',value:0]]}" optionValue="name" optionKey="value" value="${this.account?.status}"/>
                        </div> -->
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label">法人</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="fullName" id="fullName" value="${this.account?.fullName}"/>
                        </div>
                        <label class="col-md-2 control-label">法人性别</label>
                        <div class="col-md-3">
                            <g:select class="form-control m-b" name="sex" id="sex" from="${['男','女']}" value="${this.account?.sex}" noSelection="${['': '请选择性别']}"/>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label">法人电话</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="cellphone" id="cellphone" value="${this.account?.cellphone}"/>
                        </div>
                        <label class="col-md-2 control-label">法人电子邮箱</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="legalPersonEmail" id="legalPersonEmail" value="${this.account?.legalPersonEmail}"/>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label">法人从事房地产经纪年限</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="workingYears" id="workingYears" value="${this.account?.workingYears}"/>
                        </div>
                        <label class="col-md-2 control-label">法人学历</label>
                        <div class="col-md-3">
                            <g:select class="form-control m-b" name="degree" id="degree" from="${["小学", "初中", "高中", "大专","本科", "硕士研究生","博士研究生"]}" value="${this.account?.degree}" noSelection="${['': '请选择学历']}"/>
                        </div>
                    </div>

                    <div class="form-group">

                        <label class="col-md-2 control-label">省份</label>
                        <div class="col-md-3">
                            <g:select class="form-control m-b" name="province" id="province" from="${com.cindata.Province.list()}" optionValue="name" optionKey="id" value="${this?.account?.province?.id}" noSelection="${['': '请选择省份']}"/>
                        </div>

                        <label class="col-md-2 control-label">城市</label>
                        <div class="col-md-3">
                            <g:if test="${this?.account?.province}">
                                <g:select class="form-control m-b" name="city" id="city" from="${com.cindata.City.findAllByParentArea(this?.account?.province)}" optionValue="name" optionKey="id" value="${this?.account?.city?.id}" noSelection="${['': '请选择市']}"/>
                            </g:if>
                            <g:else>
                                <g:select class="form-control m-b" name="city" id="city" from="${com.cindata.City.list()}" optionValue="name" optionKey="id" value="${this?.account?.city?.id}" noSelection="${['': '请选择市']}"/>
                            </g:else>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label">地址</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="address" id="address" value="${this.account?.address}"/>
                        </div>

                        <label class="col-md-2 control-label">区域</label>
                        <div class="col-md-3">
                            <g:select class="form-control m-b" name="district" id="district" from="${com.cindata.District.findAllByParentArea(this?.account?.city)}" optionKey="id" optionValue="name" value="${this?.account?.district?.id}" noSelection="${['': '请选择行政区']}"/>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label">联系人</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="contact" id="contact" value="${this.account?.contact}"/>
                        </div>

                        <label class="col-md-2 control-label">成立日期</label>
                        <div class="col-md-3">
                            <g:datePicker class="form-control" name="establishDate" value="${new Date()}" precision="day"/>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label">企业规模</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="scale" id="scale" value="${this.account?.scale}"/>
                        </div>

                        <label class="col-md-2 control-label">单位性质</label>
                        <div class="col-md-3">
                            <g:select class="form-control m-b" name="unitNature" id="unitNature" from="${com.cindata.dictionary.OrganizationNatureDict.list()}" optionValue="name" optionKey="id" value="${this?.account?.unitNature?.id}" noSelection="${['': '请选择单位性质']}"/>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label">公司层级</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="hierarchy" id="hierarchy" value="${this.account?.hierarchy}"/>
                        </div>
                        <label class="col-md-2 control-label">电话号码（座机号）</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="phone" id="phone" value="${this.account?.phone}"/>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label">邮编</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="zipCode" id="zipCode" value="${this.account?.zipCode}"/>
                        </div>
                        <label class="col-md-2 control-label">传真</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="fax" id="fax" value="${this.account?.fax}"/>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label">电子邮箱</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="email" id="email" value="${this.account?.email}"/>
                        </div>
                        <label class="col-md-2 control-label">网址</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="website" id="website" value="${this.account?.website}"/>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label">经营期限</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="operatingPeriod" id="operatingPeriod" value="${this.account?.operatingPeriod}"/>
                        </div>
                        <label class="col-md-2 control-label">经营范围</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="scopeOfBusiness" id="scopeOfBusiness" value="${this.account?.scopeOfBusiness}"/>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label">经营状态</label>
                        <div class="col-md-3">
                            <g:select class="form-control" name="operatingState" id="operatingState" from="${com.cindata.Account.constrainedProperties.operatingState.inList}" value="${this.account?.operatingState}"
                                  noSelection="${['': '请选择经营状态']}"/>

                        </div>
                        <label class="col-md-2 control-label">经营状况</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="operatingConditions" id="operatingConditions" value="${this.account?.operatingConditions}"/>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label">公司简介</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="description" id="description" value="${this.account?.description}"/>
                        </div>
                        <label class="col-md-2 control-label">信用评级</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="creditRating" id="creditRating" value="${this.account?.creditRating}"/>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label">资质等级</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="qualificationGrade" id="qualificationGrade" value="${this.account?.qualificationGrade}"/>
                        </div>
                        <label class="col-md-2 control-label">资质等级评定日期</label>
                        <div class="col-md-3">
                            <g:datePicker class="form-control" name="dateOfQualificationRating" value="${new Date()}" precision="day"/>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label">注册资金</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="registeredCapital" id="registeredCapital" value="${this.account?.registeredCapital}"/>
                        </div>
                        <label class="col-md-2 control-label">注册资金币种</label>
                        <div class="col-md-3">
                            <g:select class="form-control m-b" name="currency" id="currency" from="${com.cindata.dictionary.CurrencyDict.list()}" optionValue="name" optionKey="id" value="${this?.financialPledge?.currency?.id}" noSelection="${['': '请选择币种']}"/>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label">是否集团公司</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="isGroupCompany" id="isGroupCompany" value="${this.account?.isGroupCompany}"/>
                        </div>
                        <label class="col-md-2 control-label">是否集团总部</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="isGroupHeadquarters" id="isGroupHeadquarters" value="${this.account?.isGroupHeadquarters}"/>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label">是否上市公司</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="isListedCompany" id="isListedCompany" value="${this.account?.isListedCompany}"/>
                        </div>
                        <label class="col-md-2 control-label">证书编号</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="certificateNumber" id="certificateNumber" value="${this.account?.certificateNumber}"/>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label">组织机构代码</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="organizationCode" id="organizationCode" value="${this.account?.organizationCode}"/>
                        </div>
                        <label class="col-md-2 control-label">营业执照</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="businessLicense" id="businessLicense" value="${this.account?.businessLicense}"/>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label">营业期限起始日期</label>
                        <div class="col-md-3">
                            <g:datePicker class="form-control" name="startDate" value="${new Date()}" precision="day"/>
                        </div>
                        <label class="col-md-2 control-label">营业期限到期日期</label>
                        <div class="col-md-3">
                            <g:datePicker class="form-control" name="endDate" value="${new Date()}" precision="day"/>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label">注销日期</label>
                        <div class="col-md-3">
                            <g:datePicker class="form-control" name="logoutDate" value="${new Date()}" precision="day"/>
                        </div>
                        <label class="col-md-2 control-label">吊销日期</label>
                        <div class="col-md-3">
                            <g:datePicker class="form-control" name="revocationDate" value="${new Date()}" precision="day"/>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label">通讯地址</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="postalAddress" id="postalAddress" value="${this.account?.postalAddress}"/>
                        </div>
                        <label class="col-md-2 control-label">登记机关</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="registerOrg" id="registerOrg" value="${this.account?.registerOrg}"/>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label">工商登记日</label>
                        <div class="col-md-3">
                            <g:datePicker class="form-control" name="registerDate" value="${new Date()}" precision="day"/>
                        </div>
                        <label class="col-md-2 control-label">备案证书号</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="recordCertificateNumber" id="recordCertificateNumber" value="${this.account?.recordCertificateNumber}"/>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label">备案日期</label>
                        <div class="col-md-3">
                            <g:datePicker class="form-control" name="recordDate" value="${new Date()}" precision="day"/>
                        </div>
                        <label class="col-md-2 control-label">发照日期</label>
                        <div class="col-md-3">
                            <g:datePicker class="form-control" name="licenseIssuingDate" value="${new Date()}" precision="day"/>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label">统一社会信用代码</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="unifiedSocialCreditCode" id="unifiedSocialCreditCode" value="${this.account?.unifiedSocialCreditCode}"/>
                        </div>
                        <label class="col-md-2 control-label">实收资本金</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="actuallyRaisingFund" id="actuallyRaisingFund" value="${this.account?.actuallyRaisingFund}"/>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label">实收资本金币种</label>
                        <div class="col-md-3">
                            <g:select class="form-control m-b" name="raisingFundCurrency" id="raisingFundCurrency" from="${com.cindata.dictionary.CurrencyDict.list()}" optionValue="name" optionKey="id" value="${this?.financialPledge?.raisingFundCurrency?.id}" noSelection="${['': '请选择币种']}"/>
                        </div>
                        <label class="col-md-2 control-label">负面信息</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="negativeInfo" id="negativeInfo" value="${this.account?.negativeInfo}"/>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label">认缴出资额</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="subscribedCapital" id="subscribedCapital" value="${this.account?.subscribedCapital}"/>
                        </div>
                        <label class="col-md-2 control-label">出资时间</label>
                        <div class="col-md-3">
                            <g:datePicker class="form-control" name="investmentDate" value="${new Date()}" precision="day"/>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label">许可证号</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="licenseNumber" id="licenseNumber" value="${this.account?.licenseNumber}"/>
                        </div>
                        <label class="col-md-2 control-label">审核时间</label>
                        <div class="col-md-3">
                            <g:datePicker class="form-control" name="auditDate" value="${new Date()}" precision="day"/>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label">融资信息</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="financingInfo" id="financingInfo" value="${this.account?.financingInfo}"/>
                        </div>
                        <label class="col-md-2 control-label">税务信息</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="taxInfo" id="taxInfo" value="${this.account?.taxInfo}"/>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label">清算信息</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="clearInfo" id="clearInfo" value="${this.account?.clearInfo}"/>
                        </div>
                        <label class="col-md-2 control-label">工商登记注册类型</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="registerType" id="registerType" value="${this.account?.registerType}"/>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label">企业总经理</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="manager" id="manager" value="${this.account?.manager}"/>
                        </div>
                        <label class="col-md-2 control-label">最近年检情况</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="recentAnnualInspection" id="recentAnnualInspection" value="${this.account?.recentAnnualInspection}"/>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label">代理机构编号</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="agencyNumber" id="agencyNumber" value="${this.account?.agencyNumber}"/>
                        </div>
                        <label class="col-md-2 control-label">注册地址行政区划代码</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="codeOfRegisterArea" id="codeOfRegisterArea" value="${this.account?.codeOfRegisterArea}"/>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label">资质名称</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="aptitudeName" id="aptitudeName" value="${this.account?.aptitudeName}"/>
                        </div>
                        <label class="col-md-2 control-label">有效期限</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="duration" id="duration" value="${this.account?.duration}"/>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label">股东人数</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="shareholdersAmount" id="shareholdersAmount" value="${this.account?.shareholdersAmount}"/>
                        </div>
                        <label class="col-md-2 control-label">资质发证日期</label>
                        <div class="col-md-3">
                            <g:datePicker class="form-control" name="qualificationIssuingDate" value="${new Date()}" precision="day"/>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label">企业简称</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="abbreviation" id="abbreviation" value="${this.account?.abbreviation}"/>
                        </div>
                        <label class="col-md-2 control-label">资质有效期限终止</label>
                        <div class="col-md-3">
                            <g:datePicker class="form-control" name="qualificationEndDate" value="${new Date()}" precision="day"/>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label">注册地址</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="registeredAddress" id="registeredAddress" value="${this.account?.registeredAddress}"/>
                        </div>
                        <label class="col-md-2 control-label">企业类型</label>
                        <div class="col-md-3">
                            <g:select class="form-control m-b" name="type" id="type" from="${com.cindata.dictionary.AccountTypeDict.list()}" optionValue="name" optionKey="id" value="${this?.account?.type?.id}" noSelection="${['': '请选择企业类型']}"/>
                        </div>
                    </div>
                
                    <div class="form-group">
                        <label class="col-md-2 control-label">公积金缴存情况</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="publicFundSituation" id="publicFundSituation" value="${this.account?.publicFundSituation}"/>
                        </div>
                        <label class="col-md-2 control-label">注册号</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="registrationNumber" id="registrationNumber" value="${this.account?.registrationNumber}"/>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label">信用等级</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="creditLevel" id="creditLevel" value="${this.account?.creditLevel}"/>
                        </div>
                        <label class="col-md-2 control-label">信用额度</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="creditAmount" id="creditAmount" value="${this.account?.creditAmount}"/>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label">核准日期</label>
                        <div class="col-md-3">
                            <g:datePicker class="form-control" name="approvalDate" value="${new Date()}" precision="day"/>
                        </div>
                        <label class="col-md-2 control-label">信用余额</label>
                        <div class="col-md-3">
                            <g:textField class="form-control" type="text" name="creditBalance" id="creditBalance" value="${this.account?.creditBalance}"/>
                        </div>
                    </div>

                    <div class="form-group">
                        <div class="col-md-3 col-md-offset-6">
                            <g:submitButton class="btn btn-info" name="update" value="保存"/>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</g:form>
<g:javascript>
    $("#province").bind("change", function(){
        $("#city option").remove();
        $("#s2id_city span:first").html("请选择城市");
        $("#city").append("<option value='' >请选择城市</option>")
        $("#district option").remove();
        $("#s2id_district span:first").html("请选择行政区");
        $("#district").append("<option value='' >请选择行政区</option>")
        var province = $("#province").val()
        if(province=='-1'){
            return
        }
        $.ajax({
            url: "/commonUtils/getAreaByParentId",
            type: "POST",
            data: {'parentId': province} ,
            success: function(result){
                for(var i=0; i < result.list.length; i++){
                    $("#city").append("<option value=" + result.list[i].id + ">" + result.list[i].name + "</option>")
                }
            }
        });
    });

    $("#city").bind("change", function(){
        $("#district option").remove();
        $("#s2id_district span:first").html("请选择行政区");
        var city = $("#city").val()
        $("#district").append("<option value='' >请选择行政区</option>")
        if(city=='-1'){
            return
        }
        $.ajax({
            url: "/district/getDistrictByCityId",
            type: "POST",
            data: {'city': city} ,
            success: function(result){
                for(var i=0; i < result.districtList.length; i++){
                    $("#district").append("<option value=" + result.districtList[i].id + ">" + result.districtList[i].name + "</option>")
                }
            }
        });
    });
</g:javascript>
</body>
</html>
